package com.ruoyi.project.system.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.dyun.tool.mybatis.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.dreamlu.mica.core.validation.CreateGroup;
import net.dreamlu.mica.core.validation.UpdateGroup;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 部门表 sys_dept
 *
 * @author dy
 */
@TableName("sys_dept")
@EqualsAndHashCode(callSuper = true)
@Data
public class SysDept extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 父部门ID
     */
    @NotNull(message = "上级部门不能为空", groups = {CreateGroup.class, UpdateGroup.class})
    private Long parentId;

    /**
     * 祖级列表
     */
    private String ancestors;

    /**
     * 部门名称
     */
    @NotBlank(message = "部门名称不能为空", groups = {CreateGroup.class, UpdateGroup.class})
    @Size(max = 30, message = "部门名称长度不能超过30个字符")
    private String deptName;

    /**
     * 排序
     */
    @NotNull(message = "排序不能为空", groups = {CreateGroup.class, UpdateGroup.class})
    private Integer seq;

    /**
     * 负责人
     */
    private String leader;

    /**
     * 联系电话
     */
    @Size(max = 11, message = "联系电话长度不能超过11个字符")
    private String phone;

    /**
     * 邮箱
     */
    @Email(message = "邮箱格式不正确")
    @Size(max = 50, message = "邮箱长度不能超过50个字符")
    private String email;
}
